package com.dream.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dream.bean.Department;
import com.dream.bean.Msg;
import com.dream.service.DepartmentService;

@Controller
public class DepartmentController {

	@Autowired
	private DepartmentService departmentService;
	
	@ResponseBody
	@RequestMapping(value="/departments",method=RequestMethod.GET)
	public Msg departmentList() {
		List<Department> departments=departmentService.getDepartmentAll();
		return Msg.Success().putData("departments", departments);
	}
	
}
